<?php

use yii\db\Migration;

/**
 * Handles the creation for table `htf_doctor`.
 */
class m160507_063744_create_htf_doctor extends Migration
{
    const TBL_NAME = '{{%doctor}}';
    /**
     * @inheritdoc
     */
    public function up()
    {
        $sql = "DROP TABLE IF EXISTS ".self::TBL_NAME.";
            CREATE TABLE ".self::TBL_NAME." (
              `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
              `u_id` int(10) DEFAULT NULL COMMENT '用户id',
              `name` varchar(50) NOT NULL DEFAULT '' COMMENT '医生真实姓名',
              `title` varchar(255) DEFAULT NULL COMMENT '职务名称',
              `head_pic` varchar(255) DEFAULT NULL COMMENT '头像地址',
              `live_pic` varchar(255) DEFAULT NULL COMMENT '生活照地址',
              `introduce` text COMMENT '自我介绍',
              `birthday` date DEFAULT NULL COMMENT '生日',
              `alipay` varchar(50) DEFAULT NULL COMMENT '支付宝账号',
              `address` varchar(255) DEFAULT NULL COMMENT '工作地址',
              `work_unit` varchar(255) DEFAULT NULL COMMENT '工作单位',
              `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '审核状态；0待审核1审核通过2未通过审核',
              `score` smallint(6) NOT NULL DEFAULT '0' COMMENT '评分',
              `response_times` int(11) NOT NULL DEFAULT '0' COMMENT '应约次数',
              `follow_numbers` int(11) NOT NULL DEFAULT '0' COMMENT '关注次数',
              PRIMARY KEY (`id`),
              UNIQUE KEY `id` (`id`) USING BTREE,
              UNIQUE KEY `u_id` (`u_id`) USING BTREE
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";

        $this->execute($sql);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable(self::TBL_NAME);
    }
}
